<?php
session_start();
$_SESSION["SITE_ID"]=101;
ini_set("include_path", "/");
require_once 'ClsSebent/Cart_class.php';
?>
<script src="ClsSebent/Cart_js.js" type="text/javascript"></script>
<?php
$current_prod_id=0;
$Cart= new Cart_class;
$Cart->Set_Vars();
$Cart->product_id=8;
//session_write_close();

$_SESSION["Cart1"]="abcdefgh";
		if(isset($_POST["btn_Checkout"]))
		{			//SAFETY OF SESSION FROM BEING LOST ON ORDER FORM..... Rakesh Rao.
			session_write_close();
			header("Location: order_form.php");					
		}
		
		if(isset($_POST["btn_OrderList"]))
		{
			session_write_close();
			header("Location: order_list.php");					
		}		

		if(isset($_POST["Product_Listorder"]))
		{
			$Cart->Product_Listorder=$_POST["Product_Listorder"];			
		}
		
		if(isset($_POST["current_prod_id"]))
		{
			$current_prod_id=$_POST["current_prod_id"];
			$Cart->product_id=$current_prod_id;							
		}
		else
		{
			$Cart->Set_Vars();
		}
		
		if(isset($_POST["txt_price".$Cart->product_id]))
		{
			$Cart->price=$_POST["txt_price".$Cart->product_id];			
		}
		
		if(isset($_POST["item".$Cart->product_id]))
		{
			$Cart->item=$_POST["item".$Cart->product_id];			
		}

		if(isset($_POST["txt_quantity".$Cart->product_id]))
		{
			$Cart->qty=$_POST["txt_quantity".$Cart->product_id];			
		}
		
		if(isset($_POST["txt_addonPrice".$Cart->product_id]))
		{
			$Cart->addon_price=$_POST["txt_addonPrice".$Cart->product_id];
		}		
		//echo 'C+'.$_POST["txt_SelectedColor".$Cart->product_id];
		if(isset($_POST["txt_SelectedColor".$Cart->product_id]))
		{
			$Cart->addon_color=$_POST["txt_SelectedColor".$Cart->product_id]; 
		}		
		//echo 'S+'.$_POST["txt_SelectedSize".$Cart->product_id];
		if(isset($_POST["txt_SelectedSize".$Cart->product_id]))
		{
			$Cart->addon_size=$_POST["txt_SelectedSize".$Cart->product_id];
		}
		
		if(isset($_POST["shipcharges".$Cart->product_id]))
		{
			$Cart->ship_charge=$_POST["shipcharges".$Cart->product_id];			
		}
		
		if(isset($_POST["contract_colors".$Cart->product_id]))
		{
			$Cart->contract_colors=$_POST["contract_colors".$Cart->product_id];
		}	
		
		if(isset($_POST["total_price".$Cart->product_id]))
		{
			$Cart->total_price=$_POST["total_price".$Cart->product_id];
		}			
//IF CALLED CALCULATE BUTTON.

		if(isset($_POST["btn_Calculate".$current_prod_id]))
		{
			$Cart->Calculate_Price();
		}
		
		if(isset($_POST["btn_AddCart".$current_prod_id]))
		{
			$Cart->Calculate_Price();
			$Cart->Add_To_Cart();
		}		
		
?>
<form name="frm_prod_catalog" action="Cart.php" method="post" enctype="application/x-www-form-urlencoded">
<table border="1" width="100%">
<tr>
        <td ><div align="center"><strong>Products List</strong></div>
        <select name="Product_Listorder">
          <option value="product_category">By Category</option>
          <option value="product_title">By Title</option>
		  <option value="product_price">By Price</option>
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <input type="submit" name="btn_Listing" value="Get Listing">
</td>
</tr>
<tr>
	<td>
		<?php echo'<h2><font color="red">'.$Cart->Message.'</font></h2>'; //?>
	</td>
</tr>
</table>
<?php
//$Cart->Product_Listorder=(isset($_POST["btn_Listing"]))? $_POST["Product_Listorder"]:"product_title";
$Cart->Show_Product_Catalog();
//$Cart->ListAddons();
?>
</form>